/*
 *	memcpy - Copy source buffer to destination buffer
 *		return destination buffer
 */
void *memcpy(void *src, void *dst, int size)
{
	char *src_c = (char *)src;
	char *dst_c = (char *)dst;
	void *dst_r = dst;
	
	if(size <= 0)
		return NULL;
	while(size--)
	{
		*dst_c++ = *src_c++;
	}
	
	return dst_r;
}

/*
 *	memmove - Copy source buffer to destination buffer
 *		return destination buffer
 */
void *memmov(void *src, void *dst, int size)
{
	void *ret = dst;
	char *src_c = (char *)src;
	char *dst_c = (char *)dst;
	
	if(dst <= src || dst >= (src + count))
	{
		while(size--)
			*dst_c++ = *src_c++;
	}
	else
	{
		dst_c += size - 1;
		src_c += size - 1;
		
		while(size--)
		{
			*dst_c--=*src_c--;
		}
	}
	
	return ret;
}

/*
 * memset - Sets "count" bytes at "dst" to "value"
 *		return buffer
 */
void *memset(char *dst, char val, int count)
{
	char *start = dst;
	
	while(count--)
		*dst++ = val;
		
	return start;
}
